import { createRouter, createWebHashHistory } from 'vue-router'
import LayOut from '@/pages/layout.vue'
import HomePage from '@/pages/HomePage.vue'
import LoginPage from '@/pages/LoginPage.vue'
import RegisterPage from '@/pages/RegisterPage.vue'

const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'LayOut',
      component: LayOut,
      redirect: '/login',
      children: [
        {
          path: '/home',
          name: 'home',
          component: HomePage
        },
        {
          path: '/find',
          name: 'find',
          component: () => import('@/pages/FindManagerPage.vue')
        },
        {
          path: '/user',
          name: 'user',
          component: () => import('@/pages/UserPage.vue')
        }
      ]
    },
    {
      path: '/login',
      name: 'login',
      component: LoginPage
    },
    {
      path: '/reg',
      name: 'reg',
      component: RegisterPage
    },

    { path: '/:pathMatch(.*)*', name: 'NotFound', component: () => import('@/pages/NotFound.vue') }
  ]
})

export default router
